UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xBQ2vP4kWWPr51cUuBw9Tq0Jqv9JNfA+u7G5G47g0xY=' 
WHERE 
  key_id = '1bda3b6b951e9fd958d3150861ee5aa1657010d4a060a6365fc69fd227efafbb' 
  AND (
    token = 'xBQ2vP4kWWPr51cUuBw9Tq0Jqv9JNfA+u7G5G47g0xY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038