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

Query time 0.00059