UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NH+e/gbCHUDOnd8GVND8Ta28tXazVuzFb9AcG6t90z8=' 
WHERE 
  key_id = '0f3500eeacee7f7918e633b553058ff3f72092ba975930ce7147f0ec31794de0' 
  AND (
    token = 'NH+e/gbCHUDOnd8GVND8Ta28tXazVuzFb9AcG6t90z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037