UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZP2v9+EVVdsC78l6XI2PlIdLich/+4ds1BF547z8iqw=' 
WHERE 
  key_id = '1433bfbd200442b7c1b2dffe4f08a8d28ee184bce97a0574176e34827b5e0695' 
  AND (
    token = 'ZP2v9+EVVdsC78l6XI2PlIdLich/+4ds1BF547z8iqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034