UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't5QU3gK8yRd2fuNSSyaOCTY8bTQnQfdI39L8DNs33qQ=' 
WHERE 
  key_id = 'c1b674a34f07bf0a56a67e36338c7d48ee72e8d824465ce2c56ff22896b11b8c' 
  AND (
    token = 't5QU3gK8yRd2fuNSSyaOCTY8bTQnQfdI39L8DNs33qQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047