UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dJmhcspzm33NcL+fNsD/jBU/GXK33HoOxmbwkiR6YKg=' 
WHERE 
  key_id = '40ceea2d4b86e795afc3d83f6febfcb97dbc0a5c3cb1f98bed5221164a79a481' 
  AND (
    token = 'dJmhcspzm33NcL+fNsD/jBU/GXK33HoOxmbwkiR6YKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033