UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e8wIGu5wyzDXY6fWgmZ+TjbAZvO5Bpb+bqVUgBtPZzM=' 
WHERE 
  key_id = '1b1070e6f364541dbf56fee51d3a94e1cb26418b22319b6ea706f70b55cb0975' 
  AND (
    token = 'e8wIGu5wyzDXY6fWgmZ+TjbAZvO5Bpb+bqVUgBtPZzM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053