UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PVhBOUEKDTYQDv4uyq8rynI5WNzLQJBv9WcOR9kjLfU=' 
WHERE 
  key_id = 'd139fb0ba5c4d725d3dc91fa17e75bcf1ba1a2dfada6da243c325647c62ae5f1' 
  AND (
    token = 'PVhBOUEKDTYQDv4uyq8rynI5WNzLQJBv9WcOR9kjLfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045