UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E3koc0xZ76YZpqn8PQnIAZy2UT35iZitSgNDzVWArro=' 
WHERE 
  key_id = '682431bbc9e0fe8d1904fac88b9b20e5b2f25c02757551cc76a93034bcd20234' 
  AND (
    token = 'E3koc0xZ76YZpqn8PQnIAZy2UT35iZitSgNDzVWArro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017