UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BAvHxvW8iMsKjJvPjgSGuAIZR6yc0isB8Dx98lipzTI='
WHERE
key_id = '5657e6b0ccb8f2e5f368ff614644847e3136262d9bb29c20e389b70552533220'
AND (
token = 'BAvHxvW8iMsKjJvPjgSGuAIZR6yc0isB8Dx98lipzTI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)