UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cqA5qqn4+sJgk0WFOlOX5YxxM/PKSo39FmAb5LVW+8Y=' 
WHERE 
  key_id = '9f0387807f94de509b727dab820aeabd2553c4c978a91ef4c3a4b9cdefbf7497' 
  AND (
    token = 'cqA5qqn4+sJgk0WFOlOX5YxxM/PKSo39FmAb5LVW+8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025