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