UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yxqBWWIRQ+a7087OPIfkTgEntYq23QC3EFzZ+7WHxxI=' 
WHERE 
  key_id = '877e2ce0c6a3387d1111e5d5579d84fcb73e25e9205317b2d8b93b31d30b661f' 
  AND (
    token = 'yxqBWWIRQ+a7087OPIfkTgEntYq23QC3EFzZ+7WHxxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042