UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/gSu5G9D6XuEv7/3Cpv5X3QOHV+g1SoSmqzTN3TWiDs='
WHERE
key_id = 'a2d7606c4f11cea3b661bc5d23915360a8abc7bd563433ce665e046e42743d04'
AND (
token = '/gSu5G9D6XuEv7/3Cpv5X3QOHV+g1SoSmqzTN3TWiDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)