UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P6SI9HkH6zQCBNwXDeFFRY3zSITSLtrfofazSZMAfW8='
WHERE
key_id = '3df84a8ade9778e38c3255225275d8ba893950cbd2374d788013e764d30b8161'
AND (
token = 'P6SI9HkH6zQCBNwXDeFFRY3zSITSLtrfofazSZMAfW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)