UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ixKNRlDPHFZHoPidFFhNq3GxejSnTXlhEnjXFNLZp+0=' 
WHERE 
  key_id = 'b1f298864ccb05e81dc5aaa94b112ec05f7e928310bff052e288a76b938bb368' 
  AND (
    token = 'ixKNRlDPHFZHoPidFFhNq3GxejSnTXlhEnjXFNLZp+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046