UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SfJat89cn9rKRkZfMiPr5yM2umMdtQDdtUy8dvOxPJc=' 
WHERE 
  key_id = '41fc86d9061727a12b966db900d99f7493074db65fe9c03fea93195353f22ac9' 
  AND (
    token = 'SfJat89cn9rKRkZfMiPr5yM2umMdtQDdtUy8dvOxPJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054