UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H9gFmwd21zPhCJFULE8iXQ0+/JvogSrLQmeX6shdKDM=' 
WHERE 
  key_id = 'b5ec68e920eac5fcb595466ffc094319f6b977cd19d1baa59f19ca7be9b50bba' 
  AND (
    token = 'H9gFmwd21zPhCJFULE8iXQ0+/JvogSrLQmeX6shdKDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037