UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ufW5F9Qv+joL/h25GKvwgcM0jd29qnLWeORHh83FVlA=' 
WHERE 
  key_id = '3ae2bbd857560f3b5db3d018c0578ad21beefa56ed0c0ae6079f4b7983de7e20' 
  AND (
    token = 'ufW5F9Qv+joL/h25GKvwgcM0jd29qnLWeORHh83FVlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049