UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EZgwrdmQKeN4wjkZOM0L9lbCUcKOms5xZE3U0XemwKQ=' 
WHERE 
  key_id = '5747b3552855b45c22ad700d44376ca57be76a89a61d770bf21cb79e91de425e' 
  AND (
    token = 'EZgwrdmQKeN4wjkZOM0L9lbCUcKOms5xZE3U0XemwKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044