UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vShA1EiynmS8ufwEWqX1grU0j9J4Gvn59m5QMU8knAg=' 
WHERE 
  key_id = '3fa4f33c2e75b08efd7d45d0c1072f947a6356ee369704badf08ba73d58eb012' 
  AND (
    token = 'vShA1EiynmS8ufwEWqX1grU0j9J4Gvn59m5QMU8knAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034