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

Query time 0.00043