UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ppx4rOXw+3JawqKvBMQ8PdzKq8ho2dDVD2Njw23k+o=' 
WHERE 
  key_id = '61b40ccd542c3851f964614f2515771b78a1aa8b5155281771123207139d54ef' 
  AND (
    token = '1ppx4rOXw+3JawqKvBMQ8PdzKq8ho2dDVD2Njw23k+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029