UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cu6/mWw2BloE+iENO9R4oh2Ulck9GMmaXxCNCH4Z5QU=' 
WHERE 
  key_id = '8b8a02ac2a11c0e03552e4a0df360668a291cc636776ce92426bf5ccf3777139' 
  AND (
    token = 'Cu6/mWw2BloE+iENO9R4oh2Ulck9GMmaXxCNCH4Z5QU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029