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