UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nfbywn9f4ZU1+ghoxGUJ3Qvy5OUbDKf3yMr0I8dyIG0=' 
WHERE 
  key_id = '7f48ac3d249148a6bda5845c824904a8c073aa2f54d5cd873155e1771b7e6fc4' 
  AND (
    token = 'Nfbywn9f4ZU1+ghoxGUJ3Qvy5OUbDKf3yMr0I8dyIG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042