UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CuAD9mjBgraScbIiQquatgZEp+/3Z4RS1/7ksFDOayo=' 
WHERE 
  key_id = 'a00083a0328d9c811b3a86eacac6ef78924c2c1ddafcdc8a1c48dc2269d8f5cf' 
  AND (
    token = 'CuAD9mjBgraScbIiQquatgZEp+/3Z4RS1/7ksFDOayo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043