UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jM/m52tG7JvQZcr4EvvPGjaG68zsmcFQ7C9pJppxnPY=' 
WHERE 
  key_id = '66f7de3481814609f8fa874feb83e2dbf06506ee630f49add88b08d485003b87' 
  AND (
    token = 'jM/m52tG7JvQZcr4EvvPGjaG68zsmcFQ7C9pJppxnPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026