UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xo/bg/qmtWPDj2g2Bn9T5FxzY9kvluvWWvJA+4xAsyk=' 
WHERE 
  key_id = '682c4da572c3007e772b1b58b968445a26d111d001bb743718997bb8023b3af6' 
  AND (
    token = 'xo/bg/qmtWPDj2g2Bn9T5FxzY9kvluvWWvJA+4xAsyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044