UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hATT8BiXAZ53Zvd4Lpe4qBLLfy5NFh/PI7ACBIr2K5A=' 
WHERE 
  key_id = '5a3f5921e6bf67129f96269d951874d8c277781e5477aeba8cb598a01d9c3c06' 
  AND (
    token = 'hATT8BiXAZ53Zvd4Lpe4qBLLfy5NFh/PI7ACBIr2K5A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019