UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JbVZX4L/Z3TsWTpma9deQ495XXJCKwTCbTdYbRDe4Dc=' 
WHERE 
  key_id = '598c1a94ca77f4267fb8bb01e790e0c1896824c43fd53639e13e806ecb4173c7' 
  AND (
    token = 'JbVZX4L/Z3TsWTpma9deQ495XXJCKwTCbTdYbRDe4Dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032