UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F+UzBCxnvFc5Y1vSBgoNDpvL6MMH+lAXaXRt90Xxw7g=' 
WHERE 
  key_id = '3b12161ba305da12b2be417aca123f748a480585e5fa3613c411a0ef7867fc54' 
  AND (
    token = 'F+UzBCxnvFc5Y1vSBgoNDpvL6MMH+lAXaXRt90Xxw7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030