UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WnNR528+LrCuSLVPsWDoOH0Ml6RR9B7HfBgbYTh+zGE=' 
WHERE 
  key_id = '54ae80164c8841e3fb8752fcc269bc0f88b834ccec14a30409a804e3173780df' 
  AND (
    token = 'WnNR528+LrCuSLVPsWDoOH0Ml6RR9B7HfBgbYTh+zGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030