UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PtflVKMFByBHZtPmALVA0hnoCwCGo6xGZugNS8eCmg4='
WHERE
key_id = 'b0551b1de86badf3df6ef34d11cedc4b1adb191134c67c5cf3e2f932f45c662f'
AND (
token = 'PtflVKMFByBHZtPmALVA0hnoCwCGo6xGZugNS8eCmg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)