UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dj983eNploREij23hEeFDDypumqTQhBCD8mi7prJgys=' 
WHERE 
  key_id = '0e883de5a7c37d64c386e76f88b04da4129c53717cc2cc9356df0589b908a4d5' 
  AND (
    token = 'dj983eNploREij23hEeFDDypumqTQhBCD8mi7prJgys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040