UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q/2p3uZVYRe95LKR6HoYWbZtJNXGx0OkuSRCbeqEXnI=' 
WHERE 
  key_id = '8fddd8d682e21179d577bd6a7b4948c689d7bbe5dcdfe57eeaca32c2dfeb0715' 
  AND (
    token = 'q/2p3uZVYRe95LKR6HoYWbZtJNXGx0OkuSRCbeqEXnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026