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